edwh-editorjs 2.4.0__py3-none-any.whl → 2.5.0a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
editorjs/__about__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.4.0"
1
+ __version__ = "2.5.0a2"
editorjs/blocks.py CHANGED
@@ -13,7 +13,7 @@ import markdown2
13
13
 
14
14
  from .exceptions import TODO, Unreachable
15
15
  from .types import EditorChildData, MDChildNode
16
-
16
+ import html2markdown
17
17
 
18
18
  class EditorJSBlock(abc.ABC):
19
19
  @classmethod
@@ -173,6 +173,9 @@ class ParagraphBlock(EditorJSBlock):
173
173
  }
174
174
  )
175
175
 
176
+ # deal with bold etc:
177
+ text = html2markdown.convert(text)
178
+
176
179
  return f"{text}\n\n"
177
180
 
178
181
  @classmethod
@@ -411,11 +414,8 @@ class ImageBlock(EditorJSBlock):
411
414
  with_background = "1" if data.get("withBackground") else ""
412
415
  stretched = "1" if data.get("stretched") else ""
413
416
 
414
- if any((with_border, with_background, stretched)):
415
- # custom type to support custom options:
416
- return f"""<editorjs type="image" caption="{caption}" border="{with_border}" background="{with_background}" stretched="{stretched}" url="{url}" />\n\n"""
417
- else:
418
- return f"""![{caption}]({url} "{caption}")\n\n"""
417
+ # always custom type so we can render as <figure> instead of markdown2's default (simple <img>)
418
+ return f"""<editorjs type="image" caption="{caption}" border="{with_border}" background="{with_background}" stretched="{stretched}" url="{url}" />\n\n"""
419
419
 
420
420
  @classmethod
421
421
  def _caption(cls, node: MDChildNode):
@@ -450,7 +450,10 @@ class ImageBlock(EditorJSBlock):
450
450
  <div class="ce-block__content">
451
451
  <div class="cdx-block image-tool image-tool--filled {background and 'image-tool--withBackground'} {stretched and 'image-tool--stretched'} {border and 'image-tool--withBorder'}">
452
452
  <div class="image-tool__image">
453
- <img class="image-tool__image-picture" src="{url}" title="{caption}" alt="{caption}">
453
+ <figure>
454
+ <img class="image-tool__image-picture" src="{url}" title="{caption}" alt="{caption}">
455
+ <figcaption>{caption}</figcaption>
456
+ </figure>
454
457
  </div>
455
458
  </div>
456
459
  </div>
editorjs/core.py CHANGED
@@ -135,7 +135,6 @@ class EditorJS:
135
135
  Export HTML string
136
136
  """
137
137
  md = self.to_markdown()
138
- # todo: deal with custom elements like linktool, attaches
139
138
  return self._md.convert(md)
140
139
 
141
140
  def __repr__(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: edwh-editorjs
3
- Version: 2.4.0
3
+ Version: 2.5.0a2
4
4
  Summary: EditorJS.py
5
5
  Project-URL: Homepage, https://github.com/educationwarehouse/edwh-EditorJS
6
6
  Author-email: SKevo <skevo.cw@gmail.com>, Robin van der Noord <robin.vdn@educationwarehouse.nl>
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Requires-Python: >=3.10
16
+ Requires-Dist: html2markdown
16
17
  Requires-Dist: humanize
17
18
  Requires-Dist: markdown2
18
19
  Requires-Dist: mdast
@@ -0,0 +1,10 @@
1
+ editorjs/__about__.py,sha256=O6yBsT7WZo17QYOgF3gqlE2IeQi3L0_e111Yrla6P-8,24
2
+ editorjs/__init__.py,sha256=-OHUf7ZXfkbdFB1r85eIjpHRfql-GCNUCKuBEdEt2Rc,58
3
+ editorjs/blocks.py,sha256=2E5H8fn92MNB8W8cHm6WGswBVJm9NO4O2zKuA-PdyMc,28776
4
+ editorjs/core.py,sha256=4igv2l8Rm1S92kxKrIXGIUlNHh6pnjq8F28XQr91I9o,4510
5
+ editorjs/exceptions.py,sha256=oKuWqi4CSnFGZfVZWtTZ2XZeHXm5xF-nAtX_1YLm6sI,230
6
+ editorjs/helpers.py,sha256=q861o5liNibMTp-Ozay17taF7CTNsRe901lYhhxdwHg,73
7
+ editorjs/types.py,sha256=W7IZWMWgzJaQulybIt0Gx5N63rVj4mEy73VJWo4VAQA,1029
8
+ edwh_editorjs-2.5.0a2.dist-info/METADATA,sha256=lFBhrmXNrj0R4tyDCParEmEoGD1qHpvB3r8-p2-yPL4,1027
9
+ edwh_editorjs-2.5.0a2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
+ edwh_editorjs-2.5.0a2.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- editorjs/__about__.py,sha256=yLaFvd-K80rs_ClRVYULStijkok4RfYSaanIt_E-aKM,22
2
- editorjs/__init__.py,sha256=-OHUf7ZXfkbdFB1r85eIjpHRfql-GCNUCKuBEdEt2Rc,58
3
- editorjs/blocks.py,sha256=QDUJ55UmDDZxZOxkigGHZ-JC7CP_sDH94Y_z-PRVXf8,28648
4
- editorjs/core.py,sha256=ra1LADSPiZpbzeAZaVzsJ8aGc3m3xYUO4bpyQLPV3h0,4576
5
- editorjs/exceptions.py,sha256=oKuWqi4CSnFGZfVZWtTZ2XZeHXm5xF-nAtX_1YLm6sI,230
6
- editorjs/helpers.py,sha256=q861o5liNibMTp-Ozay17taF7CTNsRe901lYhhxdwHg,73
7
- editorjs/types.py,sha256=W7IZWMWgzJaQulybIt0Gx5N63rVj4mEy73VJWo4VAQA,1029
8
- edwh_editorjs-2.4.0.dist-info/METADATA,sha256=Jwtr4YkhOPCssoqI4pLpvl7kpvHMFgpU74tHPQyG7Gc,996
9
- edwh_editorjs-2.4.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
- edwh_editorjs-2.4.0.dist-info/RECORD,,